//Introduction Functor(仿函数)
#include<iostream>
#include<functional>
using namespace std;

class AddTwoNums
{
public:
    AddTwoNums(int a,int b):_a(a),_b(b){}
    int operator()(){return _a+_b;}
private:
    int _a;
    int _b;
};



int main()
{
    AddTwoNums add(2,2);
    std::function<int(void)> f2 = add;
    cout<<f2()<<endl;
    return 0;
}